﻿namespace Pp.UI.Binders
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web.Mvc;
    using Dto;

    public class CreateProjectBinder : ModelBinder
    {
        public override Type Handles
        {
            get { return typeof(ProjectCreate); }
        }

        protected override object BindDTO(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            var model = (ProjectCreate)BindModelInBase(controllerContext, bindingContext);
            //var linksStr = controllerContext.HttpContext.Request.Form["Links"];

            //var links = string.IsNullOrEmpty(linksStr) ? new List<string>() : linksStr.Split(',').ToList();
            //model.Links = links;
            return model;
        }
    }
}